package edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseService;

import edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseDao.BigUserDAO;

import edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseEntity.BigUser;

import edu.ynu.se.xiecheng.achitectureclass.common.service.LogicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class BigUserService extends LogicService<BigUserDAO, BigUser, Long> {

    @Autowired
    private BigUserDAO userDAO;

    public BigUserService(BigUserDAO dao) {
        super(dao);
    }

    // 根据用户名查找用户
    public BigUser findByUsername(String username) {
        return userDAO.findByUsername(username)
                .orElseThrow(() -> new RuntimeException("User not found"));
    }

    // 可以添加其他自定义业务逻辑方法
}